<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>教师授课管理</title>
	<meta name="decorator" content="default"/>
	<%@ include file="/WEB-INF/views/include/dialog.jsp"%>
	<script type="text/javascript">
	$(document).ready(function() {
		$("#btnExport").click(function(){
			top.$.jBox.confirm("确认要导出学生数据吗？","系统提示",function(v,h,f){
				if(v=="ok"){
					$("#searchForm").attr("action","${ctx}/dd/ddTeacherCourse/export");
					$("#searchForm").submit();
				}
			},{buttonsFocus:1});
			top.$('.jbox-body .jbox-icon').css('top','55px');
		});
		$("#btnImport").click(function(){
			$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
				bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
		});
	});
		function page(n,s){
			if(n) $("#pageNo").val(n);
			if(s) $("#pageSize").val(s);
			$("#searchForm").attr("action","${ctx}/dd/ddTeacherCourseManger/list");
			$("#searchForm").submit();
	    	return false;
	    };
        function setDowmUrl(){
			var url='${ctxStatic}'+"/xls/教师授课表.xlsx";
			location.href =url;
	    };
        function openDialog(ddTeacherId,type){
	    	if(type==1){
	    		$("#iframe").attr("src","${ctx}/dd/ddTeacherCourse/list?teacherId=" + ddTeacherId); 
	    	}else if(type==2){
	    		$("#iframe").attr("src","${ctx}/dd/ddTeacherCourse/form?teacherId=" + ddTeacherId); 
	    	}
			$("#dialog").dialog({
			bgiframe: true,
	        resizable: true, //是否可以重置大小
	        height: 500, //高度
	        width: 626, //宽度
	        draggable: false, //是否可以拖动。
	        title: "授课管理",
	        modal: true,
	        show : {
				effect : 'drop',
				direction : 'up'
			}
			});
		};
	</script>
</head>
<body>
	<div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/dd/ddTeacherCourse/import" method="post" enctype="multipart/form-data"
			class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
			<%-- <a href="${ctx}/dd/ddStudent/import/template">下载模板</a> --%>
				<a id="dowmTable" href="javascript:;" onclick="setDowmUrl();">下载模板</a>
		</form>
	</div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/dd/ddTeacherCourseManger">教师列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="ddTeacher" action="${ctx}/dd/ddTeacherCourseManger" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>教师姓名：</label>
				<form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			<li><label>专业：</label>
				<form:input path="major" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
			<input id="btnImport" class="btn btn-primary" type="button" value="导入"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>教师姓名</th>
				<th>性别</th>
				<th>所属学校</th>
				<th>专业</th>
				<th>联系电话</th>
				<th>手机号码</th>
				<th>微信号</th>
				<shiro:hasPermission name="dd:ddTeacherCourseManger:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="ddTeacher">
			<tr>
				<td><a href="${ctx}/dd/ddTeacher/form?id=${ddTeacher.id}">
					${ddTeacher.name}
				</a></td>
				<td>
					${fns:getDictLabel(ddTeacher.sex, 'sex',1)}
				</td>
				<td>
					${fns:getSchoolName(ddTeacher.schoolId)}
				</td>
				<td>
					${ddTeacher.major}
				</td>
				<td>
					${ddTeacher.contactPhone}
				</td>
				<td>
					${ddTeacher.mobile}
				</td>
				<td>
				<!-- 微信号显示区 -->
				</td>
				<shiro:hasPermission name="dd:ddTeacherCourseManger:edit"><td>
    				<a href="javascript:;" onclick="openDialog('${ddTeacher.id}','1')" title="授课列表">授课列表</a>
    				<a href="javascript:;" onclick="openDialog('${ddTeacher.id}','2')" title="添加授课">添加授课</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	<div style="display:none;overflow:hidden;padding:3px" id="dialog">
		<iframe frameborder="no" border="0" marginwidth="0" marginheight="0"
			id="iframe" scrolling="auto" width="100%" height="100%"></iframe>
	</div>
</body>
</html>